





layui.use(['form','layer','laydate'],function (){

    var form = layui.form;
    var layer = layui.layer;
    var laydate = layui.laydate;


    laydate.render({
        elem: '#userbirth'
    });


    $.ajax({
        type: 'get',
        url: '/home/getUser',
        success: function (res) {
            var data = res.data;


            //获得Session中的当前登陆用户的所有信息
            console.log(sessionStorage.getItem("userA"))


            //1021新增打印
            console.log(localStorage.getItem("userRemark"));
            console.log(localStorage.getItem("userEmail"));
            console.log(localStorage.getItem("userDateBirth"));


            $("input[name='userPhone']").val(localStorage.getItem("userPhone"));
            $("input[name='userName']").val(localStorage.getItem("uname"));

            //1021朱浩榕
            $("input[name='userRemark']").val(localStorage.getItem("userRemark"));
            $("input[name='userEmail']").val(localStorage.getItem("userEmail"));
            $("input[name='userDateBirth']").val(localStorage.getItem("userDateBirth"));
        }

    })


    form.on('submit(submit)',function (data){


        let userRemark = $('input[name="userRemark"]').val();
        let userEmail = $('input[name="userEmail"]').val();
        let userDateBirth = $('input[name="userDateBirth"]').val();

        var userId =  localStorage.getItem("uid");
        console.log(userDateBirth)

        $.ajax({
            type: 'get',
            url: '/home/updateUserData',
            data:{userId,userRemark,userEmail,userDateBirth},
            success:function (res){
                console.log(data);
                layer.msg(res.msg,{time:2000});
                console.log(res.msg)



                console.log(userRemark);
                console.log(userEmail);
                console.log(userDateBirth);




                window.setTimeout(function () {
                    window.location.reload();
                },2000)
            }
        })
    })





})












